package com.bootdo.member.service.impl;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bootdo.member.dao.ShequMemberDao;
import com.bootdo.member.domain.ShequMember;
import com.bootdo.member.service.ShequMemberService;



@Service
public class ShequMemberServiceImpl implements ShequMemberService {
	@Autowired
	private ShequMemberDao shequMemberDao;
	
	@Override
	public ShequMember get(Long id){
		return shequMemberDao.get(id);
	}
	
	@Override
	public List<ShequMember> list(Map<String, Object> map){
		return shequMemberDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return shequMemberDao.count(map);
	}
	
	@Override
	public int save(ShequMember shequMember){
	
		if(shequMember.getId() != null) {
			return shequMemberDao.update(shequMember);
		}else {
			return shequMemberDao.save(shequMember);
		}		
	
		
	}
	
	@Override
	public int update(ShequMember shequMember){
		return shequMemberDao.update(shequMember);
	}
	
	@Override
	public int remove(Long id){
		return shequMemberDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return shequMemberDao.batchRemove(ids);
	}

	@Override
	public ShequMember getByMobile(String mobile) {
		return shequMemberDao.getByMobile(mobile);
	}

	@Override
	public ShequMember selectMobileAndPassWord(String mobile, String password) {

			password= DigestUtils.sha256Hex(password);
		return shequMemberDao.selectMobileAndPassWord(mobile,password);
	}

	@Override
	public int updateIntegerAdd(Double integral, String mobile) {
		return shequMemberDao.updateIntegerAdd(integral,mobile);
	}

	@Override
	public int updateIntegerMinus(Double integral, String mobile) {
		return shequMemberDao.updateIntegerMinus(integral,mobile);
	}

	@Override
	public List<ShequMember> listDescByMoney(HashMap<String, Object> map) {
		return shequMemberDao.listDescByMoney(map);
	}


}
